import java.util.ArrayList;
import java.util.List;
import java.util.Random;

public class RandomNumberProcessing {
    public static void main(String[] args) {
        Random random = new Random();
        List<Integer> factors = new ArrayList<>();

        while (true) {
            int aInt = random.nextInt(100) + 1;
            System.out.println("生成的随机整数为: " + aInt);

            if (aInt >= 50 && aInt <= 60) {
                System.out.println("重新生成随机整数...");
                continue;
            }

            if (aInt % 7 == 0) {
                System.out.println("随机整数能被7整除，程序结束。");
                break;
            }

            if (aInt % 2 == 0) {
                System.out.print("随机整数是偶数，因子有：");
                for (int i = 1; i <= aInt; i++) {
                    if (aInt % i == 0) {
                        factors.add(i);
                    }
                }
                System.out.println(factors);
            } else {
                double sum = 0;
                System.out.print("随机整数是奇数，计算 s=1+1/2+...+1/" + aInt + "： ");
                for (int i = 1; i <= aInt; i++) {
                    sum += 1.0 / i;
                }
                System.out.println(sum);
            }
        }
    }
}